package com.dapeis.web.wx.wx.handler;

import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutTextMessage;

import java.util.Map;

import org.springframework.stereotype.Component;

/**
 * 微信取消关注事件处理
 * Title:WxEventUnSubscribeHandler.java WxEventUnSubscribeHandler
 * Description:
 * @author yuanyong
 * @date 2017年4月18日 上午9:23:28 
 * Email: hzyuanyong@126.com
 *
 */
@Component
public class WxEventUnSubscribeHandler implements WxMpMessageHandler {
  @Override
  public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context,
      WxMpService wxMpService, WxSessionManager sessionManager) {
	  WxMpXmlOutTextMessage m
      = WxMpXmlOutMessage.TEXT().content("感谢取消关注:").fromUser(wxMessage.getToUserName())// + wxMessage.toString()
      .toUser(wxMessage.getFromUserName()).build();
    return m;
  }

}
